# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 520
n 520(None)[return None
]:
	i: 505(), 519()
	o: 

nname: 519
n 519(None)[]:
	i: 0(f)
	o: 520()

nname: 505
n 505(None)[self._post_update_check()
]:
	i: 0(t)
	o: 520()

nname: 0
n 0(self.is_post_update())[self.is_checking = None
bus = pygui_globs['wydbus']
self.wyupdate = bus.reference(self.name, self.path)
self.sig_inst = bus.instance(self.path)
self.launch = self.wyupdate.method('launch', 'ss', '')
self.register = self.wyupdate.method('decision_agent_register', 's', 'i')
self.unregister = self.wyupdate.method('decision_agent_unregister', 's', 'i')
self.is_post_update = self.wyupdate.method('is_post_update', '', 'b')
self.post_update_valid_by_user = self.wyupdate.method('post_update_valid_by_user', '', '')
self.sig_inst.signal('update_available', 'ssss', self._update_available, 0)
self.sig_inst.signal('update_removed', 'ss', self._update_removed, 0)
self.sig_inst.signal('update_progress', 'ssi', self._update_progress, 0)
self.sig_inst.signal('update_end', 'ss', self._update_end, 0)
self.sig_inst.signal('update_failed', 'ssi', self._update_failed, 0)
self.sig_inst.signal('update_reboot', 'ss', self._update_reboot, 0)
self.sig_inst.signal('update_check_start', 'ss', self._update_check_start, 0)
self.sig_inst.signal('update_check_end', 'ss', self._update_check_end, 0)
self.sig_inst.signal('update_check_failed', 'ssi', self._update_check_failed, 0)
self.check_window, self.confirm_window, self.screen_blocker = None, None, None
self.register(self.name)
]:
	i: 
	o: 505(t), 519(f)

nname: 0
n 0(None)[self.is_checking = None
bus = pygui_globs['wydbus']
self.wyupdate = bus.reference(self.name, self.path)
self.sig_inst = bus.instance(self.path)
self.launch = self.wyupdate.method('launch', 'ss', '')
self.register = self.wyupdate.method('decision_agent_register', 's', 'i')
self.unregister = self.wyupdate.method('decision_agent_unregister', 's', 'i')
self.is_post_update = self.wyupdate.method('is_post_update', '', 'b')
self.post_update_valid_by_user = self.wyupdate.method('post_update_valid_by_user', '', '')
self.sig_inst.signal('update_available', 'ssss', self._update_available, 0)
self.sig_inst.signal('update_removed', 'ss', self._update_removed, 0)
self.sig_inst.signal('update_progress', 'ssi', self._update_progress, 0)
self.sig_inst.signal('update_end', 'ss', self._update_end, 0)
self.sig_inst.signal('update_failed', 'ssi', self._update_failed, 0)
self.sig_inst.signal('update_reboot', 'ss', self._update_reboot, 0)
self.sig_inst.signal('update_check_start', 'ss', self._update_check_start, 0)
self.sig_inst.signal('update_check_end', 'ss', self._update_check_end, 0)
self.sig_inst.signal('update_check_failed', 'ssi', self._update_check_failed, 0)
self.check_window, self.confirm_window, self.screen_blocker = None, None, None
self.register(self.name)
if self.is_post_update():
	self._post_update_check()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b020c>}
nname: 0
n 0(None)[self.check_window = UpdateWarningTextWindow(_('An update has been detected. Checking files. Please wait...'))
self.check_window.show()
self.is_checking = True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a5c2c>}
nname: 27
n 27(None)[self.check_window = None
self.is_checking = False
return None
]:
	i: 9(), 26()
	o: 

nname: 26
n 26(None)[]:
	i: 0(f)
	o: 27()

nname: 9
n 9(None)[self.check_window.hide()
]:
	i: 0(t)
	o: 27()

nname: 0
n 0(self.check_window)[]:
	i: 
	o: 9(t), 26(f)

nname: 0
n 0(None)[if self.check_window:
	self.check_window.hide()
self.check_window = None
self.is_checking = False
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a5b6c>}
nname: 68
n 68(None)[w = UpdateWarningTextWindow(text)
t = Task(w.hide)
w.show()
t.start(delay=10)
]:
	i: 39(), 55()
	o: 

nname: 55
n 55(None)[text = _('An error has occurred when checking update integrity !')
]:
	i: 27(f)
	o: 68()

nname: 39
n 39(None)[text = _('You are already using a more recent firmware')
]:
	i: 27(t)
	o: 68()

nname: 27
n 27(error_code == OLD_VERSION_ERROR)[]:
	i: 9(), 26()
	o: 39(t), 55(f)

nname: 26
n 26(None)[]:
	i: 0(f)
	o: 27()

nname: 9
n 9(None)[self.check_window.hide()
]:
	i: 0(t)
	o: 27()

nname: 0
n 0(self.check_window)[]:
	i: 
	o: 9(t), 26(f)

nname: 68
n 68(None)[w = UpdateWarningTextWindow(text)
t = Task(w.hide)
w.show()
t.start(delay=10)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[if self.check_window:
	self.check_window.hide()
if error_code == OLD_VERSION_ERROR:
	text = _('You are already using a more recent firmware')
else:
	text = _('An error has occurred when checking update integrity !')
]:
	i: 
	o: 68()

nname: 0
n 0(None)[if self.check_window:
	self.check_window.hide()
if error_code == OLD_VERSION_ERROR:
	text = _('You are already using a more recent firmware')
else:
	text = _('An error has occurred when checking update integrity !')
w = UpdateWarningTextWindow(text)
t = Task(w.hide)
w.show()
t.start(delay=10)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a5eec>}
nname: 0
n 0(None)[pygui_globs['menustack'].close_player()
self.caution_window = UpdateWarningTextWindow(_('DO NOT SWITCH OFF BOX DURING UPDATE'))
self.caution_window.show()
template = _('Update in progress (version %(version)s)')
text = template % {'version': format_version(version), 'type': type_}
self.screen_blocker = NoHomeProgressWindow(text)
self.screen_blocker.type = 'progress_update'
self.screen_blocker.show()
self.launch(type_, version)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76ab44c>}
nname: 0
n 0(None)[template = _('Do you want to install the update for %(display_name)s, (version %(version)s) ?')
text = template % {'display_name': display_name, 'version': format_version(version), 'type': type_, 'description': description}
self.confirm_window = UpdateConfirmWindow(text, confirm_action=self._do_launch, confirm_args=(type_, version))
self.confirm_window.show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a5dec>}
nname: 63
n 63(None)[self.check_window = None
return None
]:
	i: 45(), 62()
	o: 

nname: 62
n 62(None)[]:
	i: 27(f)
	o: 63()

nname: 45
n 45(None)[self.check_window.hide()
]:
	i: 27(t)
	o: 63()

nname: 27
n 27(self.check_window)[self.confirm_window = None
]:
	i: 9(), 26()
	o: 45(t), 62(f)

nname: 26
n 26(None)[]:
	i: 0(f)
	o: 27()

nname: 9
n 9(None)[self.confirm_window.hide()
]:
	i: 0(t)
	o: 27()

nname: 0
n 0(self.confirm_window)[]:
	i: 
	o: 9(t), 26(f)

nname: 63
n 63(None)[self.check_window = None
return None
]:
	i: 0()
	o: 

nname: 0
n 0(None)[if self.confirm_window:
	self.confirm_window.hide()
self.confirm_window = None
if self.check_window:
	self.check_window.hide()
]:
	i: 
	o: 63()

nname: 0
n 0(None)[if self.confirm_window:
	self.confirm_window.hide()
self.confirm_window = None
if self.check_window:
	self.check_window.hide()
self.check_window = None
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a5f8c>}
nname: 62
n 62(None)[return None
]:
	i: 29(), 61()
	o: 

nname: 61
n 61(None)[]:
	i: 0&21(f)
	o: 62()

nname: 29
n 29(None)[self.screen_blocker.progress = i
self.screen_blocker.total = '%s%%' % i
]:
	i: 0&21(t)
	o: 62()

nname: 0&21
n 0&21(check is not None and not check)[check = self.is_checking
]:
	i: 
	o: 29(t), 61(f)

nname: 0&21
n 0&21(None)[check = self.is_checking
if check is not None and not check:
	self.screen_blocker.progress = i
	self.screen_blocker.total = '%s%%' % i
return None
]:
	i: 
	o: 

self.nodes: {'0&21': <unpyclib.structure.node instance at 0xb76a5eac>}
nname: 0
n 0(None)[self.screen_blocker.hide()
self.caution_window.hide()
w = TextWindow(_('Update was successfully installed. The box will reboot automatically'))
w.show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a5f6c>}
nname: 27
n 27(None)[self.caution_window.hide()
template = _('Update (version %(version)s) failed. Please reboot.')
text = template % {'version': format_version(version)}
w = TextWindow(text)
w.show()
]:
	i: 9(), 26()
	o: 

nname: 26
n 26(None)[]:
	i: 0(f)
	o: 27()

nname: 9
n 9(None)[self.screen_blocker.hide()
]:
	i: 0(t)
	o: 27()

nname: 0
n 0(self.screen_blocker)[]:
	i: 
	o: 9(t), 26(f)

nname: 0
n 0(None)[if self.screen_blocker:
	self.screen_blocker.hide()
self.caution_window.hide()
template = _('Update (version %(version)s) failed. Please reboot.')
text = template % {'version': format_version(version)}
w = TextWindow(text)
w.show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a5f0c>}
nname: 0
n 0(None)[from pygui.config import version
w = PostUpdateWindow(format_version(version), self.post_update_valid_by_user)
w.show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a5c4c>}
nname: 0
n 0(None)[Task(reboot).start(delay=1)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a59cc>}
nname: 36
n 36(None)[return None
]:
	i: 9(), 35()
	o: 

nname: 35
n 35(None)[]:
	i: 0(f)
	o: 36()

nname: 9
n 9(None)[self.confirm_window.hide()
self.confirm_window = None
]:
	i: 0(t)
	o: 36()

nname: 0
n 0(self.confirm_window)[]:
	i: 
	o: 9(t), 35(f)

nname: 0
n 0(None)[if self.confirm_window:
	self.confirm_window.hide()
	self.confirm_window = None
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a58ec>}
nname: 6
n 6(None)[__doc__ = 'Update manager. Handles the UI for notifying the user of updates\n    and helping him install them.'
__metaclass__ = MetaSingleton
name = 'com.wyplay.update'
path = '/com/wyplay/Update'
def __init__(self):
	self.is_checking = None
	bus = pygui_globs['wydbus']
	self.wyupdate = bus.reference(self.name, self.path)
	self.sig_inst = bus.instance(self.path)
	self.launch = self.wyupdate.method('launch', 'ss', '')
	self.register = self.wyupdate.method('decision_agent_register', 's', 'i')
	self.unregister = self.wyupdate.method('decision_agent_unregister', 's', 'i')
	self.is_post_update = self.wyupdate.method('is_post_update', '', 'b')
	self.post_update_valid_by_user = self.wyupdate.method('post_update_valid_by_user', '', '')
	self.sig_inst.signal('update_available', 'ssss', self._update_available, 0)
	self.sig_inst.signal('update_removed', 'ss', self._update_removed, 0)
	self.sig_inst.signal('update_progress', 'ssi', self._update_progress, 0)
	self.sig_inst.signal('update_end', 'ss', self._update_end, 0)
	self.sig_inst.signal('update_failed', 'ssi', self._update_failed, 0)
	self.sig_inst.signal('update_reboot', 'ss', self._update_reboot, 0)
	self.sig_inst.signal('update_check_start', 'ss', self._update_check_start, 0)
	self.sig_inst.signal('update_check_end', 'ss', self._update_check_end, 0)
	self.sig_inst.signal('update_check_failed', 'ssi', self._update_check_failed, 0)
	self.check_window, self.confirm_window, self.screen_blocker = None, None, None
	self.register(self.name)
	if self.is_post_update():
		self._post_update_check()
	return None

def _update_check_start(self, type_, version):
	self.check_window = UpdateWarningTextWindow(_('An update has been detected. Checking files. Please wait...'))
	self.check_window.show()
	self.is_checking = True

def _update_check_end(self, type_, version):
	if self.check_window:
		self.check_window.hide()
	self.check_window = None
	self.is_checking = False
	return None

def _update_check_failed(self, type_, version, error_code):
	if self.check_window:
		self.check_window.hide()
	if error_code == OLD_VERSION_ERROR:
		text = _('You are already using a more recent firmware')
	else:
		text = _('An error has occurred when checking update integrity !')
	w = UpdateWarningTextWindow(text)
	t = Task(w.hide)
	w.show()
	t.start(delay=10)

def _do_launch(self, type_, version):
	pygui_globs['menustack'].close_player()
	self.caution_window = UpdateWarningTextWindow(_('DO NOT SWITCH OFF BOX DURING UPDATE'))
	self.caution_window.show()
	template = _('Update in progress (version %(version)s)')
	text = template % {'version': format_version(version), 'type': type_}
	self.screen_blocker = NoHomeProgressWindow(text)
	self.screen_blocker.type = 'progress_update'
	self.screen_blocker.show()
	self.launch(type_, version)

def _update_available(self, type_, display_name, description, version):
	template = _('Do you want to install the update for %(display_name)s, (version %(version)s) ?')
	text = template % {'display_name': display_name, 'version': format_version(version), 'type': type_, 'description': description}
	self.confirm_window = UpdateConfirmWindow(text, confirm_action=self._do_launch, confirm_args=(type_, version))
	self.confirm_window.show()

def _update_removed(self, a, b):
	if self.confirm_window:
		self.confirm_window.hide()
	self.confirm_window = None
	if self.check_window:
		self.check_window.hide()
	self.check_window = None
	return None

def _update_progress(self, a, b, i):
	check = self.is_checking
	if check is not None and not check:
		self.screen_blocker.progress = i
		self.screen_blocker.total = '%s%%' % i
	return None

def _update_end(self, a, b):
	self.screen_blocker.hide()
	self.caution_window.hide()
	w = TextWindow(_('Update was successfully installed. The box will reboot automatically'))
	w.show()

def _update_failed(self, type_, version, error_code):
	if self.screen_blocker:
		self.screen_blocker.hide()
	self.caution_window.hide()
	template = _('Update (version %(version)s) failed. Please reboot.')
	text = template % {'version': format_version(version)}
	w = TextWindow(text)
	w.show()

def _post_update_check(self):
	from pygui.config import version
	w = PostUpdateWindow(format_version(version), self.post_update_valid_by_user)
	w.show()

def _update_reboot(self, a, b):
	Task(reboot).start(delay=1)

def unplug_update(self):
	if self.confirm_window:
		self.confirm_window.hide()
		self.confirm_window = None
	return None

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76a520c>}
nname: 0
n 0(None)[from __future__ import absolute_import
__all__ = ['UpdateManager']
from pygui.window import Button, ConfirmWindow, MessageWindow, NoHomeProgressWindow, TextWindow
from pygui.window.updatewindow import UpdateConfirmWindow, UpdateWarningTextWindow, PostUpdateWindow
from pygui.shared import pygui_globs
from peewee.misc_utils import MetaSingleton
from peewee.notifier import Task
from peewee.version import format_version
from .power import reboot
OLD_VERSION_ERROR = -1000
class UpdateManager(object):
	__doc__ = 'Update manager. Handles the UI for notifying the user of updates\n    and helping him install them.'
	__metaclass__ = MetaSingleton
	name = 'com.wyplay.update'
	path = '/com/wyplay/Update'
	def __init__(self):
		self.is_checking = None
		bus = pygui_globs['wydbus']
		self.wyupdate = bus.reference(self.name, self.path)
		self.sig_inst = bus.instance(self.path)
		self.launch = self.wyupdate.method('launch', 'ss', '')
		self.register = self.wyupdate.method('decision_agent_register', 's', 'i')
		self.unregister = self.wyupdate.method('decision_agent_unregister', 's', 'i')
		self.is_post_update = self.wyupdate.method('is_post_update', '', 'b')
		self.post_update_valid_by_user = self.wyupdate.method('post_update_valid_by_user', '', '')
		self.sig_inst.signal('update_available', 'ssss', self._update_available, 0)
		self.sig_inst.signal('update_removed', 'ss', self._update_removed, 0)
		self.sig_inst.signal('update_progress', 'ssi', self._update_progress, 0)
		self.sig_inst.signal('update_end', 'ss', self._update_end, 0)
		self.sig_inst.signal('update_failed', 'ssi', self._update_failed, 0)
		self.sig_inst.signal('update_reboot', 'ss', self._update_reboot, 0)
		self.sig_inst.signal('update_check_start', 'ss', self._update_check_start, 0)
		self.sig_inst.signal('update_check_end', 'ss', self._update_check_end, 0)
		self.sig_inst.signal('update_check_failed', 'ssi', self._update_check_failed, 0)
		self.check_window, self.confirm_window, self.screen_blocker = None, None, None
		self.register(self.name)
		if self.is_post_update():
			self._post_update_check()
		return None

	def _update_check_start(self, type_, version):
		self.check_window = UpdateWarningTextWindow(_('An update has been detected. Checking files. Please wait...'))
		self.check_window.show()
		self.is_checking = True

	def _update_check_end(self, type_, version):
		if self.check_window:
			self.check_window.hide()
		self.check_window = None
		self.is_checking = False
		return None

	def _update_check_failed(self, type_, version, error_code):
		if self.check_window:
			self.check_window.hide()
		if error_code == OLD_VERSION_ERROR:
			text = _('You are already using a more recent firmware')
		else:
			text = _('An error has occurred when checking update integrity !')
		w = UpdateWarningTextWindow(text)
		t = Task(w.hide)
		w.show()
		t.start(delay=10)

	def _do_launch(self, type_, version):
		pygui_globs['menustack'].close_player()
		self.caution_window = UpdateWarningTextWindow(_('DO NOT SWITCH OFF BOX DURING UPDATE'))
		self.caution_window.show()
		template = _('Update in progress (version %(version)s)')
		text = template % {'version': format_version(version), 'type': type_}
		self.screen_blocker = NoHomeProgressWindow(text)
		self.screen_blocker.type = 'progress_update'
		self.screen_blocker.show()
		self.launch(type_, version)

	def _update_available(self, type_, display_name, description, version):
		template = _('Do you want to install the update for %(display_name)s, (version %(version)s) ?')
		text = template % {'display_name': display_name, 'version': format_version(version), 'type': type_, 'description': description}
		self.confirm_window = UpdateConfirmWindow(text, confirm_action=self._do_launch, confirm_args=(type_, version))
		self.confirm_window.show()

	def _update_removed(self, a, b):
		if self.confirm_window:
			self.confirm_window.hide()
		self.confirm_window = None
		if self.check_window:
			self.check_window.hide()
		self.check_window = None
		return None

	def _update_progress(self, a, b, i):
		check = self.is_checking
		if check is not None and not check:
			self.screen_blocker.progress = i
			self.screen_blocker.total = '%s%%' % i
		return None

	def _update_end(self, a, b):
		self.screen_blocker.hide()
		self.caution_window.hide()
		w = TextWindow(_('Update was successfully installed. The box will reboot automatically'))
		w.show()

	def _update_failed(self, type_, version, error_code):
		if self.screen_blocker:
			self.screen_blocker.hide()
		self.caution_window.hide()
		template = _('Update (version %(version)s) failed. Please reboot.')
		text = template % {'version': format_version(version)}
		w = TextWindow(text)
		w.show()

	def _post_update_check(self):
		from pygui.config import version
		w = PostUpdateWindow(format_version(version), self.post_update_valid_by_user)
		w.show()

	def _update_reboot(self, a, b):
		Task(reboot).start(delay=1)

	def unplug_update(self):
		if self.confirm_window:
			self.confirm_window.hide()
			self.confirm_window = None
		return None



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7699c4c>}
from __future__ import absolute_import
__all__ = ['UpdateManager']
from pygui.window import Button, ConfirmWindow, MessageWindow, NoHomeProgressWindow, TextWindow
from pygui.window.updatewindow import UpdateConfirmWindow, UpdateWarningTextWindow, PostUpdateWindow
from pygui.shared import pygui_globs
from peewee.misc_utils import MetaSingleton
from peewee.notifier import Task
from peewee.version import format_version
from .power import reboot
OLD_VERSION_ERROR = -1000
class UpdateManager(object):
	__doc__ = 'Update manager. Handles the UI for notifying the user of updates\n    and helping him install them.'
	__metaclass__ = MetaSingleton
	name = 'com.wyplay.update'
	path = '/com/wyplay/Update'
	def __init__(self):
		self.is_checking = None
		bus = pygui_globs['wydbus']
		self.wyupdate = bus.reference(self.name, self.path)
		self.sig_inst = bus.instance(self.path)
		self.launch = self.wyupdate.method('launch', 'ss', '')
		self.register = self.wyupdate.method('decision_agent_register', 's', 'i')
		self.unregister = self.wyupdate.method('decision_agent_unregister', 's', 'i')
		self.is_post_update = self.wyupdate.method('is_post_update', '', 'b')
		self.post_update_valid_by_user = self.wyupdate.method('post_update_valid_by_user', '', '')
		self.sig_inst.signal('update_available', 'ssss', self._update_available, 0)
		self.sig_inst.signal('update_removed', 'ss', self._update_removed, 0)
		self.sig_inst.signal('update_progress', 'ssi', self._update_progress, 0)
		self.sig_inst.signal('update_end', 'ss', self._update_end, 0)
		self.sig_inst.signal('update_failed', 'ssi', self._update_failed, 0)
		self.sig_inst.signal('update_reboot', 'ss', self._update_reboot, 0)
		self.sig_inst.signal('update_check_start', 'ss', self._update_check_start, 0)
		self.sig_inst.signal('update_check_end', 'ss', self._update_check_end, 0)
		self.sig_inst.signal('update_check_failed', 'ssi', self._update_check_failed, 0)
		self.check_window, self.confirm_window, self.screen_blocker = None, None, None
		self.register(self.name)
		if self.is_post_update():
			self._post_update_check()
		return None

	def _update_check_start(self, type_, version):
		self.check_window = UpdateWarningTextWindow(_('An update has been detected. Checking files. Please wait...'))
		self.check_window.show()
		self.is_checking = True

	def _update_check_end(self, type_, version):
		if self.check_window:
			self.check_window.hide()
		self.check_window = None
		self.is_checking = False
		return None

	def _update_check_failed(self, type_, version, error_code):
		if self.check_window:
			self.check_window.hide()
		if error_code == OLD_VERSION_ERROR:
			text = _('You are already using a more recent firmware')
		else:
			text = _('An error has occurred when checking update integrity !')
		w = UpdateWarningTextWindow(text)
		t = Task(w.hide)
		w.show()
		t.start(delay=10)

	def _do_launch(self, type_, version):
		pygui_globs['menustack'].close_player()
		self.caution_window = UpdateWarningTextWindow(_('DO NOT SWITCH OFF BOX DURING UPDATE'))
		self.caution_window.show()
		template = _('Update in progress (version %(version)s)')
		text = template % {'version': format_version(version), 'type': type_}
		self.screen_blocker = NoHomeProgressWindow(text)
		self.screen_blocker.type = 'progress_update'
		self.screen_blocker.show()
		self.launch(type_, version)

	def _update_available(self, type_, display_name, description, version):
		template = _('Do you want to install the update for %(display_name)s, (version %(version)s) ?')
		text = template % {'display_name': display_name, 'version': format_version(version), 'type': type_, 'description': description}
		self.confirm_window = UpdateConfirmWindow(text, confirm_action=self._do_launch, confirm_args=(type_, version))
		self.confirm_window.show()

	def _update_removed(self, a, b):
		if self.confirm_window:
			self.confirm_window.hide()
		self.confirm_window = None
		if self.check_window:
			self.check_window.hide()
		self.check_window = None
		return None

	def _update_progress(self, a, b, i):
		check = self.is_checking
		if check is not None and not check:
			self.screen_blocker.progress = i
			self.screen_blocker.total = '%s%%' % i
		return None

	def _update_end(self, a, b):
		self.screen_blocker.hide()
		self.caution_window.hide()
		w = TextWindow(_('Update was successfully installed. The box will reboot automatically'))
		w.show()

	def _update_failed(self, type_, version, error_code):
		if self.screen_blocker:
			self.screen_blocker.hide()
		self.caution_window.hide()
		template = _('Update (version %(version)s) failed. Please reboot.')
		text = template % {'version': format_version(version)}
		w = TextWindow(text)
		w.show()

	def _post_update_check(self):
		from pygui.config import version
		w = PostUpdateWindow(format_version(version), self.post_update_valid_by_user)
		w.show()

	def _update_reboot(self, a, b):
		Task(reboot).start(delay=1)

	def unplug_update(self):
		if self.confirm_window:
			self.confirm_window.hide()
			self.confirm_window = None
		return None



